﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Wangzeran.CodeMaker.Core.Model
{
    /// <summary>
    /// 表信息实体
    /// </summary>
    [Serializable]
    public class TableModal : ICloneable
    {

        #region Fields
        /// <summary>
        /// 数据库名称
        /// </summary>
        private string databaseName;
        /// <summary>
        /// 表名
        /// </summary>
        private string tableName;
        /// <summary>
        /// 表描述
        /// </summary>
        private string tableDescription;
        /// <summary>
        /// 引用列的列名
        /// </summary>
        private string referenceColumnName;
        
        /// <summary>
        /// 行集合
        /// </summary>
        private IDictionary<string, RowModal> rows = new Dictionary<string, RowModal>();
        /// <summary>
        /// 列集合
        /// </summary>
        private IDictionary<string, ColumnModal> columns = new Dictionary<string, ColumnModal>();
        /// <summary>
        /// 外部引用的表
        /// </summary>
        private IDictionary<string, TableModal> extraTable = new Dictionary<string, TableModal>();

        #endregion


        #region Properties

        /// <summary>
        /// 数据库名称
        /// </summary>
        public string DatabaseName
        {
            get { return databaseName; }
            set { databaseName = value; }
        }
        /// <summary>
        /// 表名
        /// </summary>
        public string TableName
        {
            get { return tableName; }
            set { tableName = value; }
        }
        /// <summary>
        /// 表描述
        /// </summary>
        public string TableDescription
        {
          get { return tableDescription; }
          set { tableDescription = value; }
        }
        /// <summary>
        /// 引用列的列名
        /// </summary>
        public string ReferenceColumnName
        {
            get { return referenceColumnName; }
            set { referenceColumnName = value; }
        }
        /// <summary>
        /// 行集合
        /// </summary>
        public IDictionary<string, RowModal> Rows
        {
            get { return rows; }
            set { rows = value; }
        }
        /// <summary>
        /// 列集合
        /// </summary>
        public IDictionary<string, ColumnModal> Columns
        {
            get { return columns; }
            set { columns = value; }
        }
        /// <summary>
        /// 外部引用的表
        /// </summary>
        public IDictionary<string, TableModal> ExtraTable
        {
          get { return extraTable; }
          set { extraTable = value; }
        }

        #endregion

        #region ICloneable 成员

        public object Clone()
        {
            return this.MemberwiseClone();
        }

        #endregion
    }
}
